package com.yj.config;

import com.alibaba.dashscope.app.Application;
import com.alibaba.dashscope.app.ApplicationParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;

@Configuration
public class QytwConfig {

    @Autowired
    QytwProperty qytwProperty;

    @Bean
    //@Scope(value = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
    @Scope(value = "prototype")
    public ApplicationParam applicationParam(){
        ApplicationParam applicationParam = ApplicationParam.builder().appId(qytwProperty.getApiId())
                .apiKey(qytwProperty.getApiKey()).build();
        return applicationParam;
    }


    @Bean
    public Application application(){
        return new Application();
    }
}
